package com.neuedu.user.controller;


import com.neuedu.user.entity.User;
import com.neuedu.user.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService service;

    @RequestMapping("/selectAll")
    //http://localhost:8090/user/selectAll?uname=t&realname=张
    public List<User> selectAll(User u){
        return service.selectAll(u);
    }

    @RequestMapping("/add")
    //http://localhost:8090/user/add?uname=jerry8&realname=李四5&pass=777
    public int add(User u){
        return service.add(u);
    }
    //http://localhost:8090/user/update?uname=jerry79&realname=李四79&pass=779&id=20
    @RequestMapping("/update")
    //
    public int update(User u){
        return service.update(u);
    }

    @RequestMapping("/delete")
    //  http://localhost:8090/user/delete?id=20
    public int delete(User u){
        return service.delete(u);
    }
}
